package cn.tedu.egmvc2.controller;

import cn.tedu.egmvc2.mapper.AddressMapper;
import cn.tedu.egmvc2.pojo.entity.Address;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/address")
public class AddressController {
    @Autowired
    private AddressMapper addressMapper;
    @RequestMapping("/insert")
    void insert(Address address){
        addressMapper.insert(address);
    }
    @RequestMapping("/select")
    List<Address> select(){
        return addressMapper.select();
    }
    @RequestMapping("/delete")
    String delete(Integer id){
        addressMapper.delete(id);
        return "删除成功";
    }
    @RequestMapping("update")
    String update(Address address){
        addressMapper.update(address);
        return "修改成功";
    }
}
